import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { SpaceInfoEntity } from '../../entity/info';
import { SpaceInfoService } from '../../service/addInfo';
import { Body, Get, Inject, Post, Query } from '@midwayjs/core';
/**
 * 图片空间信息
 */
@Provide()
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],

  entity: SpaceInfoEntity,
  service: SpaceInfoService,
    // 分页查询配置
    pageQueryOp: {
      // 让title字段支持模糊查询
      keyWordLikeFields: ["title"],
      // 让type字段支持筛选，请求筛选字段与表字段一致是情况
      fieldEq: ["status"],
      // 指定返回字段，注意多表查询这个是必要的，否则会出现重复字段的问题
      // select: ["a.*", "b.name", "a.name AS userName"],
    }

})
export class BaseAppSpaceInfoController extends BaseController {

  @Inject()
  spaceInfoService: SpaceInfoService;

  @Post('/sqlPage', { summary: '退出' })
  async sqlPage(@Body() body) {
    console.log(body,'bodybody')
    let data = await this.spaceInfoService.sqlPage(body);
    return this.ok(data);
  }
} 

